// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

const {ccclass, property} = cc._decorator;

@ccclass
export default class NewClass extends cc.Component {
    all: cc.Node = null;
    allScript: cc.Component = null;

    onLoad () {

        this.all = cc.find('Canvas/bg');
        this.allScript = this.all.getComponent('choice');

        this.node.on('toggle', this.ToggleEvent, this);
    }

    ToggleEvent(e){
        var toggle = e;
        if(toggle.isChecked){
            this.allScript.choices = 0;
        }
        
    }


    start () {

    }

    // update (dt) {}
}
